import java.util.Random;

public class Pet {
    private String name;
    private String type;//类型
    private int age;

     private String coatColor;//毛色
    private int hungerDegree;//饥饿度
    private boolean survive;//存活状态

    public Pet() {
    }

    public Pet(String name, String type, int age, String coatColor, int hungerDegree) {
        this.name = name;
        this.type = type;
        this.age = age;
        this.coatColor = coatColor;
        this.hungerDegree = hungerDegree;
        this.survive =false;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getCoatColor() {
        return coatColor;
    }

    public void setCoatColor(String coatColor) {
        this.coatColor = coatColor;
    }

    public int getHungerDegree() {
        return hungerDegree;
    }

    public void setHungerDegree(int hungerDegree) {
        this.hungerDegree = hungerDegree;
    }

    public boolean getSurvive() {
       return survive;
    }

    public void setSurvive(boolean survive) {
        this.survive = survive;
    }



    @Override
    public String toString() {
        return "Pet{" +
                "name='" + name + '\'' +
                ", type='" + type + '\'' +
                ", age=" + age +
                ", coatColor='" + coatColor + '\'' +
                ", hungerDegree=" + hungerDegree +
                '}';
    }
    public void print(){
        System.out.println(this.toString());
    }

    public void hungerRange(){
            hungerDegree+=5;
            if(hungerDegree>=100){
                setSurvive(true);
                System.out.println(this.name+"已经没了");
            }
    }
    public void feedThing(){
        //吃东西
        if(!survive){
            hungerDegree-=5;
            System.out.println(this.name+"已经在吃了,饥饿减少");
        }else{
            System.out.println(this.name+"早饿死了");
        }

    }
}
